<template>
    <el-dialog custom-class="form-dialog" :title="title" :visible.sync="dialogVisible" :close-on-click-modal="false" width="800px" v-loading="loading"
        :before-close="handleClose">
        <!-- 表单内容 -->
        <div class="form-dialog-content-box">
            <el-form :model="form" label-width="100px" :rules="rules" ref="ruleForm" :size="size">
                <el-form-item label="网站名称：" prop="name">
                    <el-input v-model="form.name" :size="size"></el-input>
                </el-form-item>
                <el-form-item label="网址：" prop="url">
                    <el-input v-model="form.url" :size="size"></el-input>
                </el-form-item>
                <el-form-item label="所属地区：" prop="country">
                    <el-input v-model="form.country" :size="size"></el-input>
                </el-form-item>
                <el-form-item label="状态：" prop="status">
                    <el-switch v-model.number="form.status" :active-value="1" :inactive-value="0"></el-switch>
                </el-form-item>
            </el-form>
        </div>
        <!-- 提交区域 -->
        <span slot="footer" class="dialog-footer">
            <el-button @click="handleCancelBtn" :size="size">取 消</el-button>
            <el-button type="primary" @click="handleSubmitBtn" :size="size">确 定</el-button>
        </span>
    </el-dialog>
</template>

<script>
//引入混入逻辑
import mixin from '@/mixins/form'
export default {
    name: "formDialog",
    mixins: [mixin],
    props: {
        title: {
            type: String,
            default: "新增"
        }
    },
    data() {
        return {
            loading: false,//页面加载状态

            dialogVisible: false,//对话框展示状态
            form: {
                id: "",
                name: "",
                url: "",
                country: "",
                status: 1
            },//表单数据

            rules: {
                name: [
                    { required: true, message: '请输入网站名称', trigger: 'blur' },
                ],
                url: [
                    { required: true, message: '请输入网址', trigger: 'blur' },
                ],
                country: [
                    { required: true, message: '请输入所属地区', trigger: 'blur' },
                ],
            },//表单验证规则
        }
    },
    methods: {
        
    }
}
</script>